<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var name="name1";
    var obj={
        name:"name2",
        a:function () {
            console.log(this.name)
        },
        b:{
            name:"name3",
            a:function () {
                console.log(this.name)
            }
        }


    }
    obj.a();//name2
    obj.b.a();//name3
    var ax=obj.b.a();
    ax();
</script>

</body>
</html>